class Solution(object):
    def countQuadruplets(self, nums):
        n = len(nums)
        print(nums)
        ans = 0
        for i in range(n - 3):
            for j in range(i + 1, n - 2):
                for k in range(j + 1, n - 1):
                    for z in range(k + 1, n):
                        if nums[i] + nums[j] + nums[k] == nums[z]:
                            print(i, j, k, z)
                            ans += 1
        return ans

data = Solution()
nums = [28,8,49,85,37,90,20,8]
print(data.countQuadruplets(nums))